﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Data;
using KPIS.GERP.GHRMS.DAL;
using KPIS.GERP.GHRMS.MODEL;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.GERP.GHRMS.IDAL;
using KPIS.GERP.GHRMS.DALFactory;

namespace KPIS.GERP.GHRMS.BLL
{
    public class FieldGroupBLL : IFieldGroupBLL
    {
        private static readonly IFieldGroupDAL DAL = DataAccess.CreateFieldGroups();
        private static readonly IEmployeeTypeDAL empDAL = DataAccess.CreateEmployeeTypes();

        private EmployeeTypeInfo empInfo = new EmployeeTypeInfo();
        public IList<FieldGroupInfo> ListFieldGroups(Nullable<int> Sequence, Nullable<int> EmployeeTypes)
        {
            return DAL.ListFieldGroups(Sequence, EmployeeTypes);
        }
        public void Insert(string Name, string Description, int EmployeeTypes, int CreatedBy)
        {
            try
            {
                empInfo.Sequence = EmployeeTypes;

                DAL.Insert(new FieldGroupInfo(0, Name, Description, empInfo, CreatedBy, 0));
            }
            catch
            {
                throw new Exception("");
            }
        }
        public void Update(int Sequence, string Name, string Description, int EmployeeTypes, int UpdatedBy)
        {
            try
            {
                empInfo.Sequence = EmployeeTypes;

                DAL.Update(new FieldGroupInfo(Sequence, Name, Description, empInfo, 0, UpdatedBy));
            }
            catch
            {
                throw new Exception("");
            }
        }
        public void Delete(int Sequence, int UpdatedBy)
        {
            try
            {
                DAL.Delete(Sequence, UpdatedBy);
            }
            catch
            {
                throw new Exception("");
            }
        }
        
        
    }
}
